from config import Config


def decode_predictions_custom(preds: list, top=5):
    """
    模仿from keras.applications.vgg16 import decode_predictions
    :param preds:模型预测结果
    :param top:
    :return: 所属类别
    """
    results = []
    for pred in preds:
        top_indices = pred.argsort()[-top:][::-1]
        result = [tuple(Config.CLASS_CUSTOM[i]) + (pred[i] * 100,) for i in top_indices]
        results.append(result)
    return results
